package com.gitee.wsl.ext.number


/** Snaps float value s to a given step.
 * This can also be used to round a floating point number to an arbitrary number of decimals. */
fun stepify(s: Int, step: Int) = (s / step) * step

/** Snaps float value s to a given step.
 * This can also be used to round a floating point number to an arbitrary number of decimals. */
fun stepify(s: Long, step: Long) = (s / step) * step

/** Snaps float value s to a given step.
 * This can also be used to round a floating point number to an arbitrary number of decimals. */
fun stepify(s: Float, step: Float) = kotlin.math.floor(s / step) * step

/** Snaps float value s to a given step.
 * This can also be used to round a floating point number to an arbitrary number of decimals. */
fun stepify(s: Double, step: Double) = kotlin.math.floor(s / step) * step
